package com.mobiletrain.org.motherkitch.fenlei.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.mobiletrain.org.motherkitch.R;
import com.mobiletrain.org.motherkitch.fenlei.bean.Stage;
import com.mobiletrain.org.motherkitch.fenlei.bean.User;

import java.util.ArrayList;

/**
 * Created by aaa on 15-4-27.
 */
public class ThirdListAdapter extends BaseAdapter {
    private ArrayList<User> arrays;
    private ArrayList<Stage> arrays1;

    Context context;


    public ThirdListAdapter(Context context,ArrayList<User> arrays) {
        this.arrays = arrays;
        this.context=context;
    }


    @Override
    public int getCount() {
        if(arrays!=null){
            return arrays.size();
        }
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return arrays.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public boolean isEnabled(int position) {
        return true;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        MyHoder hoder=null;
        if(convertView==null){
            convertView= LayoutInflater.from(context).inflate(R.layout.fenlei_third_list_item,null);
            hoder=new MyHoder();
            hoder.text1= (TextView) convertView.findViewById(R.id.third_item_text);
            hoder.text2= (TextView) convertView.findViewById(R.id.third_item_text1);
            convertView.setTag(hoder);
        }else{
            hoder= (MyHoder) convertView.getTag();
        }
        User user=arrays.get(position);
        hoder.text1.setText(user.getName());
        hoder.text2.setText(user.getNum());
        return convertView;
    }
    class MyHoder {
        TextView text1;
        TextView text2;
    }
}
